package spider

import (
	"yuanchang/spider/http"
)

type SpiderInterface interface {
	StartRequest()
}

type ResponseFunc func(spider *Spider, response *http.Response) (chan *http.Request)

type Spider struct {
	Name           string
	AllowedDomains []string
	StartUrls      []string
	Responses      map[string]ResponseFunc
}

func NewSpider(spiderName string, startUrls []string, responses map[string]ResponseFunc) *Spider {
	spider := &Spider{}
	spider.Name = spiderName
	spider.StartUrls = startUrls
	spider.Responses = responses
	return spider
}
